package
{
	import BasicEngine.Dispatcher;
	import DataStore.BmpDataPool;
	import fl.controls.List;
	import fl.controls.SelectableList;
	import fl.controls.TextArea;
	import fl.controls.UIScrollBar;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.media.Sound;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.utils.Dictionary;
	import GameLogic.ApiCheck;
	import GameLogic.ApiItem;
	import GameLogic.Game;
	import GameLogic.ImgBtn;
	import GameLogic.ScrollPanel;
	import LoadUnit.LoadManager;
	import Map.MapManager;
	import RobotPlayer.BaseRobot;
	import RobotPlayer.RobotFactory;
	import SoundManager.Esound1;
	import SoundManager.SoundFactory;
	
	[SWF(width = "760", height = "580", backgroundColor = "0xffffff",frameRate = "60")]
	public class Robotlua extends Sprite
	{
		public function Robotlua()
		{
			Init();
			this.addEventListener(Event.ENTER_FRAME, GameEntry);	
			Dispatcher.RegistTaskUnit(0, 12000, 10, 10, null, function(data:Object):void
			{
				RobotFactory.CreateRobotNameColor(600, 500, "太空来客", 0xffddff).Run();
			});
		}
		
		private function GameEntry(e:Event):void
		{
			if (BmpDataPool.ParseImgsFinished && SoundFactory.SoundLoadFinished)
			{
			    this.removeEventListener(Event.ENTER_FRAME, GameEntry);
				Game.Star();
			    Game.DesignUI();
			    CreateRobot();	
			}
		}
		
		public function Init():void
		{
			Game.Init(this, graphics, 760, 580);
			LoadManager.LoadInit();
			SoundFactory.Init();
			MapManager.Init();
		}
		
		private function CreateRobot():void
		{
			var player:BaseRobot = RobotFactory.CreatePlayer(300, 300);
			player.Run();
		}
	}
}